package cdu.xjj.result;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.List;

/**
 * 封装分页数据
 * @param <T> 数据类型
 */
@Setter
@Getter
@NoArgsConstructor
public class PageResult<T> {
    private Long total;    // 总记录数
    private List<T> records;  // 当前页数据
    private Integer page;    // 当前页码
    private Integer pageSize; // 每页条数
    private Integer pages;    // 总页数
    
    /**
     * 简单构造函数（用于兼容旧代码）
     */
    public PageResult(Long total, List<T> records) {
        this.total = total;
        this.records = records;
    }
    
    /**
     * 完整构造函数
     */
    public PageResult(Long total, List<T> records, Integer page, Integer pageSize, Integer pages) {
        this.total = total;
        this.records = records;
        this.page = page;
        this.pageSize = pageSize;
        this.pages = pages;
    }



}
